package com.mhg.collection.theList;

import java.util.Scanner;

public class Main2 {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int count = candy(n);
        System.out.println(count);
    }


    public static int candy(int n){
        int count = 0;

        //2 count = 1 2/2 = 1 count =2
        for(int i = n ; i != 1 ; i /= 2, count++){
            if(n == 3){
                return count += 2;
            }
            if(i % 2 != 0){
                if ((i + 1) / 2 % 2 == 0) i++;
                else i--;
                count++;
            }
        }
        return count;
    }

}


